package com.algorithm.offer.string;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

/**
 * @Author: huangzhigao
 * @Date: 2021/11/28 15:08
 */
public class Leecode438 {
    public List<Integer> findAnagrams(String s, String p) {
        ArrayList<Integer> res = new ArrayList<>();
        if (s == null || p == null || s.length() < p.length()) {
            return res;
        }
        int n = p.length();
        int[] c2 = new int[26];
        int[] c1 = new int[26];
        for (int i = 0; i < p.length(); i++) {
            c2[p.charAt(i) - 'a']++;
        }

        for (int l = 0, r = 0; r < s.length(); r++) {
            c1[s.charAt(r) - 'a']++;

        }
        return res;
    }


    public boolean check(int[] c1, int[] c2) {
        for (int i = 0; i < c1.length; i++) {
            if (c1[i] != c2[i]) {
                return false;
            }
        }
        return true;
    }


}
